package org.example;

public class Leetcode_11 {
    public int maxArea(int[] height) {
        int front = 0,after = height.length - 1;
        int maxArea = 0,area;
        while (front < after){
            int min = Integer.min(height[front], height[after]);
            area = min * (after - front);
            if (area > maxArea){
                maxArea = area;
            }

            if (height[front] > height[after]){
                after--;
            }else {
                front++;
            }
        }

        return maxArea;
    }
}
